calculation of equivalent resistance